/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package day04;

import java.util.Scanner;

/**
 *
 * @author Administrator
 */
public class MutiArray {

    private int[][] array = new int[3][3];

    /*
     * Nhap phan tu
     */
    public void nhap() {
        Scanner s = new Scanner(System.in);
        for (int i = 0; i < this.array.length; i++) {
            for (int j = 0; j < this.array.length; j++) {
                System.out.println("Nhap vao phan tu so Array [" + i + "][" + j + "]");
                this.array[i][j] = s.nextInt();
            }
        }
    }
    /*
     * Xuat phan tu
     */

    public void xuat() {
        for (int i = 0; i < this.array.length; i++) {
            for (int j = 0; j < this.array[0].length; j++) {
                System.out.println("Array[" + i + "][" + j + "]" + this.array[i][j]);

            }

        }


    }
    /*
     * Tinh trung binh
     */

    public float tinhTrungBinh() {
        float sum = 0;
        for (int i = 0; i < this.array.length; i++) {
            for (int j = 0; j < this.array.length; j++) {
                sum += this.array[i][j];
            }

        }
        return sum / (this.array.length * this.array[0].length);

    }
    /*
     * dem so nguyen to
     */

    public int demSNT() {

       int count = 0;
        for (int i = 0; i < this.array.length; i++) {
            for (int j = 0; j < this.array.length; j++) {
                if (SNTUtils.ktSNT(this.array[i][j])) {
                    count++;
                }

            }

        }

        return count;



    }
}
